import request from "./request";
const apiUrl = '/apiBase';//巢箱接口
const manageUrl='/manage';//网站后端接口
// 鸟类活动节律
export const getBirdsActivity =  (params) => {
    return request({
        url: apiUrl +'/get_data/1',
        method: 'get' ,
        params,
    })

}

// 获取菜单或站点名称
export const getSiteName =  (params) => {
    return request({
        url: manageUrl +'/InstallUnit/GetALL',
        method: 'get' ,
        params,
    })
}

//创建巢箱
export const CreateMonitoringPoint =  (data) => {
    return request({
        url: manageUrl +'/MonitoringPoint/Create',
        method: 'post' ,
        data:data,
        // headers: {  
        //         'Content-Type': 'multipart/form-data'  
        //     }  
    })

}
//获取巢箱分页数据
export const GetMonitoringPointPage =  (data) => {
    return request({
        url: manageUrl +'/MonitoringPoint/GetMonitoringPointPage',
        method: 'post' ,
        data:data,
    })

}
//删除巢箱数据
export const DeleteMonitorPoint =  (params) => {
    return request({
        url: manageUrl +'/MonitoringPoint/Delete',
        method: 'delete' ,
        params,
    })
}
//获取单位名称
export const getUnitsName =  () => {
    return request({
        url: manageUrl +'/InstallUnit/GetAllUnit',
        method: 'get' 
    })
}
//添加单位
export const AddUnit =  (data) => {
    return request({
        url: manageUrl +'/InstallUnit/Create',
        method: 'post' ,
        data:data,
    })
}
//删除单位
export const DeleteUnit =  (params) => {
    return request({
        url: manageUrl +'/InstallUnit/Delete',
        method: 'delete' ,
        params,
    })
}

// 加载视频
export const loadVideo = (videonumber)=>{
    return request({
            url: manageUrl +'/Video/StartVideoStream',
            method: 'get' ,
            videonumber,
        })
}
// 关闭视频
export const closeVideo = (videonumber)=>{
    return request({
            url: manageUrl +'/Video/StopVideoStream',
            method: 'get' ,
            videonumber,
        })
}

/**
 * 开始识别
 * @param {*} videonumber 
 * @returns 
 */
export const startIdentify = (videonumber)=>{
    return request({
            url: manageUrl +'/Video/StartIdentify',
            method: 'get' ,
            videonumber,
        })
}
/**
 * 关闭
 * @param {*} videonumber 
 * @returns 
 */
export const closeIdentify = (videonumber)=>{
    return request({
            url: manageUrl +'/Video/StopIdentify',
            method: 'get' ,
            videonumber,
        })
}

// 获取最近1条监测活动
export const getLastActive = (params)=>{
    return request({
            url: manageUrl +'/MonitoringPoint/GetLastActive',
            method: 'get' ,
            params,
        })
}
// 获取最近10条监测活动
export const getSnapshot = (data)=>{
    return request({
            url: manageUrl +'/MonitoringPoint/GetSnapshot',
            method: 'post' ,
            data:data,
        })
}

// 获取当天或当月的统计值
export const getStatistics = (data)=>{
    return request({
            url: manageUrl +'/MonitoringPoint/GetStatistics',
            method: 'post' ,
            data:data,
        })
}

// 分页获取监测活动
export const getActivePage = (data)=>{
    return request({
            url: manageUrl +'/MonitoringPoint/GetActivePage',
            method: 'post' ,
            data:data,
        })
}